// 新闻页
var dataBase = require('../../data/posts-data.js')
Page({
  onLoad: function () {
    this.setData({postData: dataBase.postList})
  },
  // 点击文章列表跳转
  onTapList: function(e) {  
    var postId = e.currentTarget.dataset.postid
    this.setNavigation(postId);
  },
  // 点击轮播图跳转
  onTapSwiper: function(e) {
    var postId = e.target.dataset.postid
    this.setNavigation(postId);
  },
  // 设置路由路径
  setNavigation: function (postId) {
    wx.navigateTo({
      url: 'news-detail/news-detail?id=' + postId
    })
  }
})
